{% extends "base.html" %}
{% block title %}Event: {{ event }}{% endblock %}
{% block main_content %}
    <h3>Swingtime Event</h3>
    <h4>Event Details</h4>
    <form action="" method="post">
    <table>
        <tfoot>
            <tr>
                <td colspan="2">
                    <input type="submit" name="_update" value="Update" />
                </td>
            </tr>
        </tfoot>
        <tbody>
        {% include "swingtime/event_form_part.html" %}
        </tbody>
    </table>
    </form>
    
    <h4>Notes</h4>
    {% with event.notes.all as notes %}
    {% if notes %}
    <ul>
        {% for note in notes %}
        <li>{{ note }}</li>
        {% endfor %}
    </ul>
    {% else %}
    <p>None</p>
    {% endif %}
    {% endwith %}

    <h4>Occurrences</h4>
    {% if event.occurrence_set.count %}
    <ol>
        {% for o in event.occurrence_set.all %}
        <li>
            <a href="{% url swingtime-occurrence event.id o.id %}">
                {{ o.start_time|date:"l, F jS, Y P" }} &ndash; 
                {{ o.end_time|date:"l, F jS, Y P" }}</a>
        </li>
        {% endfor %}
    </ol>
    {% else %}
    {% endif %}
    
    <h4>Add Occurrences</h4>
    <form action="" method="post">
    <table>
        <tfoot>
            <tr>
                <td colspan="2"><input type="submit" name="_add" value="Add" /></td>
            </tr>
        </tfoot>
        <tbody>
        {% include "swingtime/recurring_form_part.html" %}
        </tbody>
    </table>
    </form>
    </form>
{% endblock %}